<?php
	error_reporting(E_ALL^E_NOTICE);
	require_once ('../config/config.php'); 
	require_once './api/config/config.php';
	if (empty($AppId) or empty($AuthAPI) or empty($API)) {
        echo "请配置华宇通行证config.php文件！";
    }
	session_start();
	if(!empty($_SESSION['member'])){
		echo "<script>location='./index.php';</script>";
	}
	if($_POST['login']){
	    $user=$_POST['user'];
	    $password=md5($_POST['password']);
	    $userRs=mysqli_fetch_row(mysqli_query($con,"select * from member where user='".$user."' and password='".$password."'"));
		$rs=mysqli_fetch_array(mysqli_query($con,"select * from member where user='".$user."'"));
	    if($userRs){
			if($rs['state']!="1"){
				exit("<script>alert('该账号状态异常，登录失败！');history.back();</script>");
			}
	        $_SESSION['member']=$user;
	        mysqli_query($con,$sql="insert into loginLog values('','".$_SESSION['member']."','".getip()."','".date("Y/m/d H:i:s")."')");
	        echo "<script>alert('登录成功！');location='./index.php';</script>";
	    }else{
	        echo "<script>alert('登录失败！');history.back();</script>";
	    }
	    
	}
?>
<html lang="zh-CN" class="translated-ltr"><head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

	<!-- CSS -->
	<link rel="stylesheet" href="css/bootstrap-reboot.min.css">
	<link rel="stylesheet" href="css/bootstrap-grid.min.css">
	<link rel="stylesheet" href="css/owl.carousel.min.css">
	<link rel="stylesheet" href="css/nouislider.min.css">
	<link rel="stylesheet" href="css/select2.min.css">
	<link rel="stylesheet" href="css/jquery.mCustomScrollbar.min.css">
	<link rel="stylesheet" href="css/ionicons.min.css">
	<link rel="stylesheet" href="css/main.css">

	<!-- Favicons -->
	<link rel="icon" type="image/png" href="icon/favicon-32x32.png" sizes="32x32">
	<link rel="apple-touch-icon" href="icon/favicon-32x32.png">
	<link rel="apple-touch-icon" sizes="72x72" href="icon/apple-touch-icon-72x72.png">
	<link rel="apple-touch-icon" sizes="114x114" href="icon/apple-touch-icon-114x114.png">
	<link rel="apple-touch-icon" sizes="144x144" href="icon/apple-touch-icon-144x144.png">

	<meta name="description" content="">
	<meta name="keywords" content="">
	<meta name="author" content="Dmitry Volkov">
	<title>校园兼职网站 - 登录</title>
<link type="text/css" rel="stylesheet" charset="UTF-8" href="https://translate.googleapis.com/translate_static/css/translateelement.css"></head>

<body>
	<div class="sign">
		<div class="container">
			<div class="row">
				<div class="col-12">
					<div class="sign__content">
						<!-- authorization form -->
						<form action="./signin.php" method="post" class="sign__form">

							<div class="sign__group">
								<input type="text" name="user" class="sign__input" placeholder="账号">
							</div>

							<div class="sign__group">
								<input type="password" name="password" class="sign__input" placeholder="密码">
							</div>

							<div class="sign__group sign__group--checkbox">
								<input id="remember" name="remember" type="checkbox" checked="checked">
								<label for="remember"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">记住账号</font></font></label>
							</div>
						
							<input  class="sign__btn" type="submit" name="login" value="登入">
							<br />
							<a href="<?php echo $AuthAPI;?>?Id=<?php echo $AppId;?>"><button class="sign__btn" type="button"><span><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;使用 华宇通行证 登入&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></font></span></button></a>

							<span class="sign__text"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">还没有帐号？</font></font><a href="signup.php"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">注册！</font></font></a></span>

							<span class="sign__text"><a href="forgot.php"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">忘记密码？</font></font></a></span>
						</form>
						<!-- end authorization form -->
					</div>
				</div>
			</div>
		</div>
	</div>

	<!-- JS -->
	<script src="js/jquery-3.4.1.min.js"></script>
	<script src="js/bootstrap.bundle.min.js"></script>
	<script src="js/owl.carousel.min.js"></script>
	<script src="js/wNumb.js"></script>
	<script src="js/nouislider.min.js"></script>
	<script src="js/select2.min.js"></script>
	<script src="js/jquery.mousewheel.min.js"></script>
	<script src="js/jquery.mCustomScrollbar.min.js"></script>
	<script src="js/main.js"></script><div id="goog-gt-tt" class="skiptranslate" dir="ltr"><div style="padding: 8px;"><div><div class="logo"><img src="https://www.gstatic.com/images/branding/product/1x/translate_24dp.png" width="20" height="20" alt="Google 翻译"></div></div></div><div class="top" style="padding: 8px; float: left; width: 100%;"><h1 class="title gray">原文</h1></div><div class="middle" style="padding: 8px;"><div class="original-text"></div></div><div class="bottom" style="padding: 8px;"><div class="activity-links"><span class="activity-link">提供更好的翻译建议</span><span class="activity-link"></span></div><div class="started-activity-container"><hr style="color: #CCC; background-color: #CCC; height: 1px; border: none;"><div class="activity-root"></div></div></div><div class="status-message" style="display: none;"></div></div>

<div class="goog-te-spinner-pos"><div class="goog-te-spinner-animation"><svg xmlns="http://www.w3.org/2000/svg" class="goog-te-spinner" width="96px" height="96px" viewBox="0 0 66 66"><circle class="goog-te-spinner-path" fill="none" stroke-width="6" stroke-linecap="round" cx="33" cy="33" r="30"></circle></svg></div></div></body></html>